<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>工单审核</title>
</head>
<body>
<form class="layui-form" action="#" lay-filter="apply-form" id="applyForm">
    <input type="hidden" name="orderId"/>
    <div class="layui-form-item">
        <label class="layui-form-label">工单处理人:</label>
        <div class="layui-form-mid layui-word-aux">
            <div id="currentHandler"></div>
            <!--<input type="text" name="handler" id="handler">
            <input type="hidden" name="handlerNo" id="handlerNo"/>
            <input type="hidden" name="handlerDept" id="handlerDept"/>-->
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"><span class="redColor">*</span>是否接受:</label>
        <div class="layui-input-block" style="width:400px;">
            <input type="radio" name="isUrgent" value="0" title="是" checked="">
            <input type="radio" name="isUrgent" value="1" title="否">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="redColor">*</span>审批意见:</label>
        <div class="layui-input-block" style="width:400px">
            <textarea placeholder="请输入审批意见" class="layui-textarea" name="applyDesc" lay-verify="applyDesc"></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="applybtn">提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script type="text/javascript">
    var form = layui.form
    window.applyForm = form.render(null,'apply-form');
    window.applyForm.verify({
        applyDesc:function(value,item){
            if(value.trim() == ''){
                return '请输入审批意见';
            }
        }
    });


    window.applyForm.on('submit(applybtn)',function(data){
        var _index = layer.load(3);
        $.ajax({
            url:window.basePath + '/order/applyOrder',
            method:'POST',
			headers: {"token" : window.token},
            dataType:'json',
            data:data.field,
            success:function(data){
                layer.close(_index);
                if(data.success){
                    layer.closeAll();
                    $(document).trigger('applyRefresh');
                }
                layer.msg(data.message);
            },
            error:function(data){
                layer.close(_index);
                layer.msg('网络异常！');
            }
        });

        return false;
    });

</script>

</body>
</html>